<?php
class DefaultSearch8Action extends PiscesAction
{
	public function __construct()
	{
		parent::__construct();
	}

	public function execute()
	{
		$keyword	= $this->context->get('q');
		if(function_exists('mb_detect_encoding'))
		{
			$defaultEncode	= $this->data['config']['system']['encode'];
			if(!empty($defaultEncode) && $defaultEncode!='UTF-8')
			{
				$encode 	= mb_detect_encoding($keyword, C('CommonFunction')->getDefaultArray($defaultEncode,array('EUC-CN','ASCII','UTF-8','GB2312','GBK','BIG5')));
				if($encode!='UTF-8')
				{
					$keyword	= iconv($encode,'UTF-8',$keyword);
				}
			}
		}
		$url	= C('ProductService')->getListUrl($keyword);
		if(empty($url))
		{
			$url	= C('LtUrl')->generate('Default','Index');
		}
		header('Location:'.$url);
	}
}
